using Pencil;
using Pencil.Attributes;
using OpenFileSystem.IO;
using Pencil.Tasks;

namespace TeamCityConfigurationMonitor.Build
{
    public class TeamCityConfigurationMonitor : Project
    {
        [Default]
        public void Build()
        {
            var t = new MSBuild40Task(FileSystem, Platform)
                    {
                        ProjectFile = @"src\TeamCityConfigurationMonitor.sln",
                        Targets = new[] {"Rebuild"}
                    };

            t.AddProperty("Configuration", "Release");

            t.Execute();
        }

        [DependsOn("Build")]
        public void Dist()
        {
            var dist = FileSystem.GetDirectory("dist");

            dist.Delete();
            dist.MustExist();

            foreach (var f in FileSystem.GetDirectory(@"src\TeamCityConfigurationMonitor\bin\Release").Files())
                f.CopyTo(dist.GetFile(f.Name));
        }
    }
}